<template>
  <div class="form">
    <el-dialog
      v-dialogDrag
      class="tiny-mce-dialog"
      :close-on-press-escape="true"
      :show-close="false"
      center
      :modal="false"
      title="结算详情"
      width="400px"
      :visible.sync="isShow" :close-on-click-modal="false"
      @close="cancel('ruleForm')"
    >
      <vue-scroll>
        <el-form ref="ruleForm" :model="ruleForm" :rules="rules" size="mini" label-position="left" :label-width="formLabelWidth">
          <el-card class="box-card">
            <div slot="header">
              <span style="color: #dd1100">为了保证您的资金安全，请谨慎操作！</span>
            </div>
            <el-row :gutter="24">
              <el-col :span="24">
                <el-form-item label="订单编号" :label-width="formLabelWidth" prop="mineSendNum">
                  <el-input v-model="ruleForm.mineSendNum" readonly />
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="运输公司" :label-width="formLabelWidth" prop="mineSendNum">
                  <el-input v-model="ruleForm.merchantName" readonly />
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="分配数量" :label-width="formLabelWidth" prop="allotNum">
                  <el-input v-model="ruleForm.allotNum" readonly>
                    <template slot="append">吨</template>
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="实发数量" :label-width="formLabelWidth" prop="mineHairNum">
                  <el-input v-model="ruleForm.mineHairNum" readonly>
                    <template slot="append">吨</template>
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="到货数量" :label-width="formLabelWidth" prop="arrivalNum">
                  <el-input v-model="ruleForm.arrivalNum" readonly>
                    <template slot="append">吨</template>
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="接单运价" :label-width="formLabelWidth" prop="takePrice">
                  <el-input v-model="ruleForm.takePrice" readonly>
                    <template slot="append">元/吨</template>
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="发布运价" :label-width="formLabelWidth" prop="issuePrice">
                  <el-input v-model="ruleForm.issuePrice" readonly>
                    <template slot="append">元/吨</template>
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="总运费" :label-width="formLabelWidth" prop="totalPrice">
                  <el-input v-model="ruleForm.totalPrice" readonly>
                    <template slot="append">元</template>
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="盈利" :label-width="formLabelWidth" prop="profit">
                  <el-input v-model="ruleForm.profit" readonly>
                    <template slot="append">元</template>
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="申请时间" :label-width="formLabelWidth" prop="applyTime">
                  <el-input v-model="ruleForm.applyTime" readonly />
                </el-form-item>
              </el-col>
            <el-col :span="24">
                <el-form-item label="结算时间" :label-width="formLabelWidth" prop="settleTime">
                  <el-input v-model="ruleForm.settleTime" readonly />
                </el-form-item>
              </el-col>
            </el-row>
          </el-card>
        </el-form>
      </vue-scroll>
      <div slot="footer" style="text-align:right" class="dialog-footer">
        <el-button type="primary" size="mini" @click="cancel">取 消</el-button>
        <!--<el-button type="primary" style="width: 40%" size="mini" v-loading.fullscreen.lock="fullscreenLoading" @click="update">结 算</el-button>-->
      </div>
    </el-dialog>
  </div>
</template>
<script>
import MyImg from '@/components/img/img'
import OssUpload from '@/components/oss-upload/oss-upload.vue'

export default {
  name: 'DriverStaff',
  filters: {
    formatStatus: function(val) {
      if (val === 'LOCK') {
        return false
      } else if (val === 'NORMAL') {
        return true
      }
      return '-'
    }
  },
  components: {
    OssUpload,
    MyImg
  },
  props: ['showFormPanel', 'item'],
  data() {
    return {
      settleImg: [],
      activeName: 'settle',
      showOperation: false,
      fullscreenLoading: false,
      customVal: { imgName: '' },
      showTreeDialog: false,
      selectOrgExpandAll: false,
      ruleForm: this.item,
      orderInfo: {},
      roleOptions: [],
      formLabelWidth: '190px',
      formLabelWidth1: '55px',
      isShow: this.showFormPanel,
      rules: {
        carLoad: [
          { required: true, message: '请输入车辆载重', trigger: 'blur' }
        ]
      }
    }
  },
  mounted: function() {
  },
  methods: {
    selectVehicleLengths(val) {
      if (!val) {
        this.ruleForm.carLength = null
        return
      }
      let obj = {}
      obj = this.vehicleLengths.find((item) => {
        return item.id === val
      })
      this.ruleForm.carLength = obj.name
    },
    selectVehicleType(val) {
      if (!val) {
        this.ruleForm.typeName = null
        return
      }
      let obj = {}
      obj = this.vehicleTypes.find((item) => {
        return item.id === val
      })
      this.ruleForm.typeName = obj.name
    },
    update() {
      const self = this
      self.$message({
        message: '网页端暂不支持结算，请到手机APP端结算！',
        type: 'error'
      })
      return
      /* self.fullscreenLoading = true
      let par = {
        id: self.ruleForm.freightSettlementId
      }
      self.$http.post('/api/platformFreightSettle/settle', par)
        .then(function (res) {
          self.fullscreenLoading = false
          self.cancel()
          self.$emit('refreshList')
        }).catch(function (error) {
          self.fullscreenLoading = false
          console.log(error)
        })*/
    },
    save() {
      const self = this
      let url = 'add'
      if (self.ruleForm.carOwnerId != null) {
        url = 'update'
      }
      if (objKey) {
        objKey.forEach((value, index) => {
          if (index === 0) {
            self.ruleForm.vehicleLicenseFirstPic = value.objKey ? imgValue + value.objKey : value.url
          }
        })
      }
      if (objKey1) {
        objKey1.forEach((value, index) => {
          if (index === 0) {
            self.ruleForm.vehicleLicenseSecondPic = value.objKey ? imgValue1 + value.objKey : value.url
          }
        })
      }
      if (objKey2) {
        objKey2.forEach((value, index) => {
          if (index === 0) {
            self.ruleForm.carPhoto = value.objKey ? imgValue2 + value.objKey : value.url
          }
        })
      }
    },
    getSettleImg() {
      const self = this
      const par = {
        id: self.item.freightSettlementId
      }
      self.$http.post('/api/platformFreightSettle/findSettleImg', par).then(function(value) {
        self.settleImg = value.data
      })
    },
    handleClick() {
      const self = this
      if (self.activeName === 'settle') {
        return
      }
      const par = {
        id: self.item.transportTakeCarriageId
      }
      self.$http.post('/api/platformFreightSettle/findOrder', par)
        .then(function(res) {
          self.fullscreenLoading = false
          if (res.ok) {
            self.orderInfo = res.data
          }
        }).catch(function(error) {
          self.fullscreenLoading = false
          console.log(error)
        })
    },
    cancel() {
      this.$refs['ruleForm'].resetFields()
      this.isShow = false
      this.$emit('update:showFormPanel', this.isShow)
    }
  }
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
.test {
  font-size: 13px;
  color: #606266;
  line-height: 15px;
  padding: 0;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  font-weight: bold;
}
.el-form-item--mini.el-form-item, .el-form-item--small.el-form-item {
  margin-bottom: 15px;
}
.mark-body{
  position:fixed;
  left:0px;
  top:0px;
  background:rgba(0, 0, 0, 0.18);
  width:100%;  /*宽度设置为100%，这样才能使隐藏背景层覆盖原页面*/
  height:100%;
  filter:alpha(opacity=60);  /*设置透明度为60%*/
  opacity:0.6;  /*非IE浏览器下设置透明度为60%*/
  z-Index:999;
}
aside {
  /* background: #eef1f6; */
  /* padding: 6px 5px; */
  background: none;
  padding: 0px 24px;
  margin-bottom: 1px;
  border-radius: 2px;
  display: block;
  /* line-height: 50px; */
  /* font-size: 48px; */
  font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;
  color: #2c3e50;
  /* -webkit-font-smoothing: antialiased; */
  -moz-osx-font-smoothing: grayscale;
}
.el-form-item__label {
  border-bottom: 1px solid #e6ebf5 !important;
}
</style>
